package com.sh.test;

import com.sh.test.inner.A;
import com.sh.test.inner.AppConfig;
import com.sh.test.inner.B;
import com.springframework.annotation.YcBean;
import com.springframework.annotation.YcComponentScan;
import com.springframework.annotation.YcConfiguration;
import com.springframework.contexttwo.ShApplicationContext;
import com.springframework.contexttwo.ShAnnotationConfigApplicationContext;

@YcConfiguration
@YcComponentScan(basePackages = {"com.sh.test"})
public class AimConfig {
    public static void main(String[] args) {
        ShApplicationContext ac = new ShAnnotationConfigApplicationContext(AppConfig.class);
       // YcApplicationContext yc = new YcAnnotationConfigApplicationContext(AimConfig.class);
        A a1 = (A) ac.getBean("a");
        B b1 = (B) ac.getBean("b");
        A a2 = a1.getB().getA();
        System.out.println("a1 = " + a1);
        System.out.println("a2 = " + a2);
        System.out.println("b1 = " + b1);
    }

    @YcBean
    public Apple Apple() {
        return new Apple();
    }
}
